﻿using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Media.Imaging;
using System.Diagnostics;
using Microsoft.Devices;
using System.Runtime.Serialization;

namespace Curling
{
    public partial class Stone : UserControl
	{
        public StoneEntity stoneEntity { get; set; }

        /*public Stone(int ID, bool CreateEntity)
        {
            InitializeComponent();

            if (CreateEntity)
            {
                stoneEntity = new StoneEntity(this) { ID = ID };
            }
        }*/

        public Stone(StoneColor stoneColor, int ID, bool CreateEntity)
            //: this(stoneColor, ID, CreateEntity)
		{
            InitializeComponent();

            if (CreateEntity)
            {
                stoneEntity = new StoneEntity(this) { ID = ID, stoneColor = stoneColor };
            }

            ChangeColor(stoneColor);
		}

        public void ChangeColor(StoneColor stoneColor)
        {
            switch (stoneColor)
            {
                case StoneColor.Yellow:
                {
                    stone.Source = new BitmapImage(new Uri("Images/Stone/stone_yellow.png", UriKind.Relative));
                    break;
                }
                case StoneColor.Red:
                {
                    stone.Source = new BitmapImage(new Uri("Images/Stone/stone_red.png", UriKind.Relative));
                    break;
                }
                case StoneColor.Blue:
                {
                    stone.Source = new BitmapImage(new Uri("Images/Stone/stone_blue.png", UriKind.Relative));
                    break;
                }
            }
        }
	}

    public enum StoneColor
    {
        Yellow,
        Red,
        Blue
    }

    public enum StoneState
    { 
        Created,
        WaitDelivery,
        OnStart,
        OnRink,
        InOut
    }
}